<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>
        <h1>{{info}}</h1>
        <input type="button" value="测试异步请求get" @click="f1()">
        <input type="button" value="测试异步请求post" @click="f2()">
    </div>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
    <script>
        let v = new Vue({
            el : "div",
            data : {
                info : "测试vue"
            },
            methods : {
                f1() {
                    //发送异步get请求
                    axios.get("/hello1Axios?info=tom").then(function (response){
                        /*response : 服务器响应对象
                        * response.data : 服务器响应的数据*/
                        alert(response.data);
                    })
                },
                f2() {
                    //发送异步post请求
                    axios.post("/hello2Axios",{info:"刘德华"}).then(function (response){
                        alert(response.data);
                    })

                }
            }
        })
    </script>

</body>
</html>